package com.vkmessenger.core.localcache;

import com.vkmessenger.core.friends.Friend;
import com.vkmessenger.net.json.FriendRequestsResponse;

import java.util.HashSet;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: CоDDeR
 * Date: 20.06.12
 * Time: 22:06
 */
public enum Cache {
    INSTANCE;
    // probably user friends
    public Set<Friend> probablyFriends = new HashSet<Friend>();

    // requests for friendship
    public Set<Friend> friendRequests = new HashSet<Friend>();

    public void setFriendRequests(FriendRequestsResponse requests) {
        for (FriendRequestsResponse.FriendRequest request : requests.response) {
            Friend friend = new Friend(request.uid, null, null, request.message);
            synchronized (friendRequests) {
                friendRequests.add(friend);
            }
        }
    }

}

